package Text;


public class Demo1 {
    public static void main(String[] args) {
        int sum = 1;//算2一个初始
        String str = "";
        for (int i = 1; i <=100; i++) {//遍历1-100
            int j = 2;//从2开始除
            while (i % j != 0) {
                j++;//被除数自增
                if (i == j) {
                    sum++;
                    str = str+i+" ";
                    break;
                }
            }
        }

        System.out.println("1-100之间的质数有"+sum+"个");
        System.out.println("1-100之间的质数有:2"+str);
    }
}